package cn.tfyhyc.springcloud.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author 头发又黑又长
 * @Date 2022/10/8 17:29
 * @email zwb15083976291@163.com
 */
@RestController
@RequestMapping("/consumer")
public class ConsumerController {
    // 这里使用的是consul 上面注册的服务名称
    public static final String URL = "http://consul-provider-payment";
    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/payment/consul")
    public String paymentInfo() {
        return restTemplate.getForObject(URL + "/payment/consul", String.class);
    }
}
